package com.qikux.service.impl;

import com.qikux.mapper.UserMapper;
import com.qikux.entity.User;
import com.qikux.service.UserService;
import com.qikux.vo.ResultVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional(rollbackFor = Exception.class)
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public ResultVo addUser(User user) {

//        User u = userMapper.selectByUsername(user.getUsername());

//        if (u == null){

            userMapper.insert(user);

            return ResultVo.ok().message("用户添加成功").body("");
//        }

//        return ResultVo.fail("用户添加失败").build();
    }
}
